Castus schedule files are plain text and line by line parsable.
All files since the inception of the format use UTF-8 Unicode encoding.

All lines except scoping curly braces are name=value pairs.
All lines outside of any scope are considered to be global scope that apply to
the schedule as a whole. For compatibility with how older versions of the
software work, global values put a space between the parts: name = value.
Ignore the trailing space on name and leading space on value.
Settings within a scope are indented with a hard ASCII TAB character, no space between name=value.

An opening curly brace by itself begins a schedule item. The schedule item
continues until the closing curly brace.

Other groups start with text, no equals sign, an open curly brace and a newline.
Default items are grouped together at the top of the file this way, for example.
The group closes with a closing curly brace.

The first line of the file, if it starts with an asterisk, names the type of
schedule. When Castus first started, only weekly schedules were supported. If
that asterisk line is missing, and the default item group at the top cannot be
used to infer otherwise, the schedule is a weekly schedule.

start and end times are represented using a calendar day, month, year,
interval day, hour, minute, second, and optionally, an am/pm suffix.
Which values exist depend on the type of schedule. Seconds are stored as a
decimal number to enable scheduling with up to millisecond precision.
Days of the week are three letter strings: sun, mon, tue, wed, thu, fri, sat.
Some fields are not written if they don't need to be written. Seconds are not
written to the time stamp if they are zero, for example.

Days and months are 1-based and years use the full four digits, so that they
are human-readable.

The schedule format does not take into consideration the local calendar, time
zone, leap years, daylight savings time, or the number of days in a month.
Any software that processes this format is expected to convert the start/end
times to/from Unix time_t for further processing using standard C runtime
functions like mktime() or localtime().

The hour is assumed 24 hour format by default. If "am" or "pm" is given, the
hour is treated as 12 hour format and "pm" then maps the hour to the last "PM"
half of the day. It has been the default behavior of the Castus schedule
editor since the beginning to match user preference and to always write the
12 hour am/pm format.

Schedule items do not have to cover the entire day or time span of the
schedule type. Gaps between items that are longer than 3 seconds are filled
with a default item indicated in the global section and in the daily default
group at the top of the schedule. On a day by day basis, the daily default for
that day overrides the global default if it is listed. It is commonly used to
schedule a general playlist for most of the schedule period while also
automatically playing a specific schedule for specific days (holidays for example).

Schedule items are always read and written in chronological order in the file,
as are schedule blocks.

